package xyz.mayday.tools.bunny.ddd.sample.batch.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
import xyz.mayday.tools.bunny.ddd.schema.http.Response;

import java.io.IOException;

@RestController
@Slf4j
public class SampleBatchController {

    @PostMapping
    public Response<Void> run() throws IOException, InterruptedException {

        Process process = Runtime.getRuntime().exec(new String[]{"java", "-jar", "/Users/gejunwen/.m2/repository/xyz/mayday/tools/bunny-ddd-framework-sample-cmd/1.0.0-SNAPSHOT/bunny-ddd-framework-sample-cmd-1.0.0-SNAPSHOT.jar"});

         return Response.success();
    }
}
